package code.formal.ch_02;

/**
 * NutritionFacts1类：
 * <p>
 * 共有6个属性，其中前两个是必填的，后四个是可选的。
 * <p>
 * <p>
 * 本例采用了JavaBean模式进行实现,即通过
 *
 * <p>
 */
public class NutritionFacts2 {

    private int servingSize;  //(ml)               必要
    private int servings;     //(per container)    必要
    private int calories;     //卡路里              可选
    private int fat;          //脂肪(g)             可选
    private int sodium;       //纳 (mg)             可选
    private int carbohydrate; //碳水化合物 (g)       可选

    public void setServingSize(int servingSize) {
        this.servingSize = servingSize;
    }

    public void setServings(int servings) {
        this.servings = servings;
    }

    public void setCalories(int calories) {
        this.calories = calories;
    }

    public void setFat(int fat) {
        this.fat = fat;
    }

    public void setSodium(int sodium) {
        this.sodium = sodium;
    }

    public void setCarbohydrate(int carbohydrate) {
        this.carbohydrate = carbohydrate;
    }

    @Override
    public String toString() {
        return "NutritionFacts1{" +
                "servingSize=" + servingSize +
                ", servings=" + servings +
                ", calories=" + calories +
                ", fat=" + fat +
                ", sodium=" + sodium +
                ", carbohydrate=" + carbohydrate +
                '}';
    }

    public static void main(String[] args) {

    }


}
